
const Controller = require('egg').Controller
const uuid = require('node-uuid')

class UserController extends Controller {
    async loggin() {
        const ctx = this.ctx
        //console.log(this.app.redis)
        let resData = ctx.session[ctx.cookies.get('sessionid')]
        if (!resData) {
            const sessionid = uuid.v1()
            ctx.session[sessionid] = ctx.request.body
            ctx.cookies.set('sessionid', sessionid)
        }
        ctx.body = resData
    }
}

module.exports = UserController